

/* TODO: edit javadoc: start, end or start, duration? */

/**
 * This class represents a measure received by the electrical measurement module.
 * A measure is represented by the start date & time, the duration (in seconds) on which
 * the measure has been taken, the mean and peak electrical consumption. In addition, we log
 * the user logged on the machine at when the measure has been taken.
 * @author Alexandre Dos Santos Coelho
 */
public class Measure {

  private static int count=1; // Used to get id's
  private int id;
  private String start;
  private int duration;
  private String userName;
  private float consumption;

  public Measure(String userName, float consumption, String start, int duration) {
    this.userName = userName;
    this.consumption = consumption;
    this.start = start;
    this.duration = duration;
    this.id = count++;
  }

  @Override
  public String toString() {
    return "measure#" + start + "#" + duration + "#" + consumption +
            "#" + userName + "#" + id ;
  }

  /**
   * @return The start date & time
   */
  public String getStart() {
    return start;
  }

  /**
   * @param start The start date & time
   */
  public void setStart(String start) {
    this.start = start;
  }

  /**
   * @return the duration
   */
  public int getDuration() {
    return duration;
  }

  /**
   * @param end The duration
   */
  public void setDuration(int duration) {
    this.duration = duration;
  }

  /**
   * @return The mean consumption
   */
  public float getConsumption() {
    return consumption;
  }

  /**
   * @param consumption Mean consumption
   */
  public void setConsumption(float consumption) {
    this.consumption = consumption;
  }
  
  /**
   * Returns the measure unique ID
   * @return the measure unique id
   */
  public int getId() {
    return id;
  }
}
